<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>DOM获得值</title>
</head>
<body>
    <span id="s1">你好，<b>世界</b></span>
    <script>
        //1.获得元素
      let s1 = document.getElementById('s1')

        //2.获得文本内容

       console.log(si.innerText);

    </script>
    <hr>
      <span id="s2">你好，<b>世界</b></span>
      <script>
        //1.获得span标签内容
      
       let s2 = document.getElementById('s2').innerHTML;
        console.log(s2); 
        
      </script>
      <hr>
      <h2>获得属性值</h2>
      <a href="http://www.163.com" id="a1">网易</a>
      <script>
        //获得A标签
        let a =document.getElementById('a1');
        //获得属性值
        let cont = a.getAttribute('href');
        console.log(cont);
        cont=a.href;
        console.log(cont);
        
        
      </script>
      <hr>
      请输入：<input type="text" value="0000000000" name="cont">
      <button>提交</button>
      <script>
        var btn = document.getElementsByTagName('button')[0]
        btn.onclick=function(){
            var input =document.getElementsByName('cont')[0];
            var cont = input.getAttribute('value')
            console.log(cont);
            cont=input.value;
            console.log(cont);
        }
      </script>
</body>
</html>